﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "batteryinfowidget.h"
#include "parametersetupwidget.h"
#include "serialport.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void selectPort(int nUartIdx, int nPort);
    void GetUartPortList(QList<QSerialPortInfo> serialList, int curIndex);
    void RecvData(QByteArray databuf, int datalen);
private slots:
    void on_btn_start_clicked();

    void on_btn_configUart_clicked();

    void on_btn_openuart_clicked();

private:
    Ui::MainWindow *ui;
    BatteryInfoWidget* m_pBatteryInfoWidget;
    SerialPort* m_SerialPort;
    QList<QSerialPortInfo> m_UartInfoList;
    int m_UartIdx;
    int m_PortNum;
};

#endif // MAINWINDOW_H
